//
//  CCYStatus.swift
//  03.微博
//
//  Created by 蔡承毅 on 16/9/27.
//  Copyright © 2016年 IOS. All rights reserved.
//

import UIKit

class CCYStatus: NSObject {
    /// 微博创建时间
    var created_at:	String?
    ///微博ID
    var id: Int64 = 0
    ///微博信息内容
    var text: String?
    ///微博来源
    var source: String?
    /// 转发数
    var reposts_count: Int = 0
    /// 评论数
    var comments_count: Int = 0
    /// 表态数
    var attitudes_count: Int = 0
    /// 返回图片 thumbnail_pic	string	缩略图片地址，没有时不返回此字段
    var pic_urls: [[String: String]]?
    /// 用户模型
    var user: CCYUser?
    
    init(dict: [String: Any]){
        super.init()
        
        setValuesForKeys(dict)
    }
    
    override func setValue(_ value: Any?, forKey key: String) {
        print("value= \(value),key= \(key)")
        if key == "user" {
            if let dict = value as? [String: Any] {
                user = CCYUser(dict: dict)
            }
            return
        }
        super.setValue(value, forKey: key)
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {}
    
    override var description: String{
        get{
            let keys = ["created_at", "id", "text", "source", "reposts_count", "comments_count", "attitudes_count", "pic_urls", "user"]
            
            let des = dictionaryWithValues(forKeys: keys)
            
            return des.description
            
        }
    }
}
